package com.shinbada.config;

import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
import com.shinbada.config.swagger.BaseSwaggerConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.util.List;

/**
 * Swagger接口扫描配置
 *
 * @author initcap
 * @date 2021/3/13 10:39
 */
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig extends BaseSwaggerConfig {

    private List<VendorExtension> extensions;

    @Autowired
    public SwaggerConfig(OpenApiExtensionResolver openApiExtensionResolver) {
        this.extensions = openApiExtensionResolver.buildSettingExtensions();
    }

    @Override
    protected List<VendorExtension> extensions() {
        return extensions;
    }

    @Override
    protected String title() {
        return "竟品分析&PCS平台";
    }

    @Override
    protected String version() {
        return "1.2.10";
    }

    @Bean
    public Docket createCompetitorApi() {
        return createSwaggerApi("竞品管理", "com.shinbada.modules.competitor");
    }

}

